﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AcctrueWMS.Foundation.WebControls
{
    public class AccCalendar : AccControl
    {

        public override string Render()
        {
            StringBuilder sb = new StringBuilder();
            #region 生成控件
            // sb.Append(GenerateDescription());
            if (this.Musted)
            {
                sb.Append("<nobr>");
            }

            if (string.IsNullOrEmpty(this.Format))
            {
                sb.Append("<input type='text'   style='cursor: hand' ReadOnly  onfocus=\"WdatePicker()\"  class=\"Wdate\" ");
            }
            else
            {
                sb.Append("<input type='text'   style='cursor: hand' ReadOnly  onfocus=\"WdatePicker({dateFmt:'" + this.Format + "'})\"  class=\"Wdate\" ");
            }
            sb.Append(GenerateBasicProperty());
            if (this.Musted)
                sb.Append(" musted='required' ");
            if (!string.IsNullOrEmpty(this.ValidExpression))
                sb.Append(" validatePattern='" + this.ValidExpression + "'");
            sb.Append(" value='" + GetControlValue() + "' ");

            if (!string.IsNullOrEmpty(Style))
                sb.Append(string.Format("style=\"{0}\"", Style));
            sb.Append(" >");
            sb.Append("</input>");
            if (this.Musted)
            {
                sb.Append("<font style='color:red'>*</font>");
                sb.Append("</nobr>");
            }

            #endregion
        
            return sb.ToString();
        }

    }
}
